<template>
	<view class="wrap-service-info">
		<view class="title f-30">服务</view>

		<view class="list flex">
			<block v-for="(item, index) in list" :key="index">
				<view class="item flex column align-center just-center" @click="onItem(item)">
					<image class="img" :src="$staticImagePath(item.icon)" />

					<view class="name f-26"> {{ item.title }}</view>
				</view>
			</block>
		</view>

		<publishPopup :isShow.sync="isShowPublishPopup" />
	</view>
</template>

<script>
	import publishPopup from "@/components/common/publishPopup.vue";
	export default {
		components: {
			publishPopup,
		},
		props: {
			userInfo: {
				type: Object,
				default: null,
			},
		},
		data() {
			return {
				isShowPublishPopup: false, // 是否显示发布弹窗
				list: [
					{
						title: "收货地址",
						icon: "mine/addressManager.png",
						url: "/pages/user/address/address",
					},
					{
						title: "我的评价",
						icon: "mine/wdpj.png",
						url: "/pages/user/comment/comment",
					},
					// {
					// 	title: "我的投诉",
					// 	icon: "mine/wdts.png",
					// 	url: "",
					// },
					{
						title: "意见反馈",
						icon: "mine/yjfk.png",
						url: "/pages/user/feedback/feedback",
					},
					{
						title: "帮助中心",
						icon: "mine/bzzx.png",
						url: "/pages/mine/mine/help",
					},
					{
						title: "我要发布",
						icon: "mine/wdfb.png",
						url: "",
						status: "alert",
					},
					{
						title: "发布列表",
						icon: "mine/fblb.png",
						url: "/pages/home/article/publishList",
					},
					{
						title: "实名认证",
						icon: "mine/smrz.png",
						url: "/pages/mine/authen/realnameAuthen",
						status: "authen",
					},
					{
						title: "机构认证",
						icon: "mine/rzzx.png",
						url: "/pages/mine/authen/authenCenter",
						status: "center",
					},
					{
						title: "群聊列表",
						icon: "mine/group_chat.png",
						url: "/pages/business/group_chat",
					},
					{
						title: "设置",
						icon: "mine/setting.png",
						url: "/pages/mine/setting/setting",
					},
				],
			};
		},
		methods: {
			/**
			 * 点击
			 */
			onItem(item) {
				if (item.status === "alert") {
					if (this.$filters.isLogin()) {
						this.isShowPublishPopup = true;
					}
					return;
				}
				if (item.status === "authen") {
					if (this.userInfo && this.userInfo.is_realname == 1) {
						this.$st.show("您已经实名认证了，无需再次认证！");
						return;
					}
				}
				if (item.status === "center") {
					if (this.userInfo && this.userInfo.is_realname == 0) {
						this.$jump.to(item.url);
						return;
					}
					if (this.userInfo && this.userInfo.behoy_auth == 1) {
						this.$st.show("您认证的信息正在审核中...");
						return;
					}
					if (this.userInfo && this.userInfo.behoy_auth == 2) {
						this.$st.show("您已经认证成功，无需再次认证！");
						return;
					}
				}
				this.$jump.to(item.url);
			},
		},
	};
</script>

<style lang="scss" scoped>
	.wrap-service-info {
		width: 100%;
		overflow: hidden;
		background-color: white;
		border-radius: 16rpx;
		overflow: hidden;
		padding: 30rpx 0rpx;

		.title {
			margin-left: 40rpx;
			color: #333333;
		}

		.list {
			margin-top: 20rpx;
			width: 100%;
			overflow: hidden;
			flex-wrap: wrap;

			.item {
				width: 25%;
				padding: 25rpx 0rpx;
				overflow: hidden;
				gap: 15rpx;

				.img {
					width: 60rpx;
					height: 60rpx;
				}

				.name {
					color: #121212;
				}
			}
		}
	}
</style>